<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script>
        var aLists = [1, 2, 3, 5, 3, 2, 1];
        var aLists2 = [];
        leng = aLists.length;
        for(var i=0; i<leng; i++){
            if( aLists.indexOf(aLists[i])===i ){
                aLists2.push(aLists[i]);
            }
        }
        alert(aLists2);

    </script>
</head>
<body>

</body>
</html>